import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DemoVO, DemoForm, DemoQuery } from '@/api/system/product/types';

/**
 * 查询数字人列表
 * @param query
 * @returns {*}
 */
export const list = (query?: DemoQuery): AxiosPromise<DemoVO[]> => {
  return request({
    url: '/digital/list',
    method: 'get',
    params: query
  });
};

/**
 * 获取数字人详细信息
 * @param id
 */
export const digital = (id: string | number): AxiosPromise<DemoVO> => {
  return request({
    url: '/digital/' + id,
    method: 'get'
  });
};

/**
 * 新增数字人
 * @param data
 */
export const add = (data: DemoForm) => {
  return request({
    url: '/digital/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改数字人
 * @param data
 */
export const edit = (data: DemoForm) => {
  return request({
    url: '/digital/edit',
    method: 'put',
    data: data
  });
};

/**
 * 删除数字人
 * @param ids
 */
export const delDemo = (ids: string | number | Array<string | number>) => {
  return request({
    url: '/digital/' + ids,
    method: 'delete'
  });
};
